

function addSensorbitCod(Blockly) {




    //温湿度传感器模块
  Blockly.Python.microbit_soil = function(block) {
    var dropdown_soil = this.getFieldValue('soil');
    Blockly.Python.definitions_['import_microbit'] = 'from microbit import *';
    Blockly.Python.definitions_['import_Soilmoisture'] = 'from sensor import soilmoisture';
    var code = "soilmoisture.get_value("+ dropdown_soil +")";
    return [code];
  }

  //温湿度传感器模块
  Blockly.Python.microbit_DHT11 = function(block) {
    var dropdown_dht11Port = this.getFieldValue('dht11Port');
    var dropdown_dnt11Func = this.getFieldValue('dnt11Func');
    Blockly.Python.definitions_['import_microbit'] = 'from microbit import *';
    Blockly.Python.definitions_['import_dht11'] = 'from sensor import dht11';
    Blockly.Python.definitions_['import_dht11Init'] = 'dht11.init('+dropdown_dht11Port+')';
    var code = "dht11."+ dropdown_dnt11Func ;
    return [code];
  }

    return Blockly;
}

module.exports = addSensorbitCod;

